1 /** 2 3 Copyright by The HDF Group. 4 Copyright by the Board of Trustees of the University of Illinois. 5 All rights reserved. 6 7 This file is part of HDF5. The full HDF5 copyright notice, including 8 terms governing use, modification, and redistribution, is contained in 9 the files COPYING and Copyright.html. COPYING can be found at the root 10 of the source code distribution tree; Copyright.html can be found at the 11 root level of an installed copy of the electronic HDF5 document set and 12 is linked from the top-level documents page. It can also be found at 13 http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have 14 access to either file, you may request a copy from help@hdfgroup.org. 15 16 Ported 2015 to the D Programming Language by Laeeth Isharc 17 18 hdf5.hl - bindings for 'high level' C API for HDF5 19 20 Not tested and may not be complete 21 */ 22 23 module hdf5.bindings.hlapi; 24 import hdf5.bindings.api; 25 import hdf5.bindings.enums; 26 27 alias hbool_t=int; 28 enum VLPT_REMOVED=false; 29 30 extern(C) 31 { 32 33 /** 34 H5DOpublic.h 35 */ 36 37 herr_t H5DOwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint filters, const hsize_t *offset, size_t data_size, const (void*) buf); 38 39 /** 40 H5DSpublic 41 */ 42 enum DimensionScaleClass = "DIMENSION_SCALE"; 43 enum DimensionList = "DIMENSION_LIST"; 44 enum ReferenceList = "REFERENCE_LIST"; 45 enum DimensionLabels = "DIMENSION_LABELS"; 46 47 alias DIMENSION_SCALE_CLASS = DimensionScaleClass; 48 alias DIMENSION_LIST = DimensionList; 49 alias REFERENCE_LIST = ReferenceList; 50 alias DIMENSION_LABELS = DimensionLabels; 51 52 53 alias H5DS_iterate_t = herr_t function(hid_t dset, uint dim, hid_t scale, void *visitor_data); 54 herr_t H5DSattach_scale( hid_t did, hid_t dsid, uint idx); 55 herr_t H5DSdetach_scale( hid_t did, hid_t dsid, uint idx); 56 herr_t H5DSset_scale( hid_t dsid, const (char*) dimname); 57 int H5DSget_num_scales( hid_t did, uint dim); 58 herr_t H5DSset_label( hid_t did, uint idx, const (char*) label); 59 ssize_t H5DSget_label( hid_t did, uint idx, char *label, size_t size); 60 ssize_t H5DSget_scale_name( hid_t did, char *name, size_t size); 61 htri_t H5DSis_scale( hid_t did); 62 herr_t H5DSiterate_scales( hid_t did, uint dim, int *idx, H5DS_iterate_t visitor, void *visitor_data); 63 htri_t H5DSis_attached( hid_t did, hid_t dsid, uint idx); 64 65 /** 66 H5IMpublic 67 */ 68 69 herr_t H5IMmake_image_8bit( hid_t loc_id, const (char*) dset_name, hsize_t width, hsize_t height, const (ubyte*) buffer ); 70 herr_t H5IMmake_image_24bit( hid_t loc_id, const (char*) dset_name, hsize_t width, hsize_t height, const (char*) interlace, 71 const (ubyte*) buffer ); 72 herr_t H5IMget_image_info( hid_t loc_id, const (char*) dset_name, hsize_t *width, hsize_t *height, hsize_t *planes, char *interlace, 73 hssize_t *npals ); 74 herr_t H5IMread_image( hid_t loc_id, const (char*) dset_name, ubyte *buffer ); 75 herr_t H5IMmake_palette( hid_t loc_id, const (char*) pal_name, const hsize_t *pal_dims, const (ubyte*) pal_data ); 76 herr_t H5IMlink_palette( hid_t loc_id, const (char*) image_name, const (char*) pal_name ); 77 herr_t H5IMunlink_palette( hid_t loc_id, const (char*) image_name, const (char*) pal_name ); 78 herr_t H5IMget_npalettes( hid_t loc_id, const (char*) image_name, hssize_t *npals ); 79 herr_t H5IMget_palette_info( hid_t loc_id, const (char*) image_name, int pal_number, hsize_t *pal_dims ); 80 herr_t H5IMget_palette( hid_t loc_id, const (char*) image_name, int pal_number, ubyte *pal_data ); 81 herr_t H5IMis_image( hid_t loc_id, const (char*) dset_name ); 82 herr_t H5IMis_palette( hid_t loc_id, const (char*) dset_name ); 83 84 /** 85 H5LPTpublic 86 */ 87 88 // Flag definitions for H5LTopen_file_image() 89 enum H5LT_FILE_IMAGE_OPEN_RW = 0x0001; // Open image for read-write 90 enum H5LT_FILE_IMAGE_DONT_COPY = 0x0002; // The HDF5 lib won't copy user supplied image buffer. The same image is open with the 91 // core driver. 92 enum H5LT_FILE_IMAGE_DONT_RELEASE= 0x0004; // The HDF5 lib won't deallocate user supplied image buffer. The user application is responsible. 93 enum H5LT_FILE_IMAGE_ALL = 0x0007; 94 95 enum H5LT_lang_t 96 { 97 H5LT_LANG_ERR = -1, /*this is the first*/ 98 H5LT_DDL = 0, /*for DDL*/ 99 H5LT_C = 1, /*for C*/ 100 H5LT_FORTRAN = 2, /*for Fortran*/ 101 H5LT_NO_LANG = 3 /*this is the last*/ 102 } 103 104 /** 105 106 Make dataset functions 107 108 */ 109 110 herr_t H5LTmake_dataset( hid_t loc_id, const (char*) dset_name, int rank, const hsize_t *dims, hid_t type_id, const (void*) buffer ); 111 herr_t H5LTmake_dataset_char( hid_t loc_id, const (char*) dset_name, int rank, const hsize_t *dims, const (char*) buffer ); 112 herr_t H5LTmake_dataset_short( hid_t loc_id, const (char*) dset_name, int rank, const hsize_t *dims, const short *buffer ); 113 herr_t H5LTmake_dataset_int( hid_t loc_id, const (char*) dset_name, int rank, const hsize_t *dims, const int *buffer ); 114 herr_t H5LTmake_dataset_long( hid_t loc_id, const (char*) dset_name, int rank, const hsize_t *dims, const long *buffer ); 115 herr_t H5LTmake_dataset_float( hid_t loc_id, const (char*) dset_name, int rank, const hsize_t *dims, const float *buffer ); 116 herr_t H5LTmake_dataset_double( hid_t loc_id, const (char*) dset_name, int rank, const hsize_t *dims, const double *buffer ); 117 herr_t H5LTmake_dataset_string( hid_t loc_id, const (char*) dset_name, const (char*) buf ); 118 119 /** 120 121 Read dataset functions 122 123 */ 124 125 herr_t H5LTread_dataset( hid_t loc_id, const (char*) dset_name, hid_t type_id, void *buffer ); 126 herr_t H5LTread_dataset_char( hid_t loc_id, const (char*) dset_name, char *buffer ); 127 herr_t H5LTread_dataset_short( hid_t loc_id, const (char*) dset_name, short *buffer ); 128 herr_t H5LTread_dataset_int( hid_t loc_id, const (char*) dset_name, int *buffer ); 129 herr_t H5LTread_dataset_long( hid_t loc_id, const (char*) dset_name, long *buffer ); 130 herr_t H5LTread_dataset_float( hid_t loc_id, const (char*) dset_name, float *buffer ); 131 herr_t H5LTread_dataset_double( hid_t loc_id, const (char*) dset_name, double *buffer ); 132 herr_t H5LTread_dataset_string( hid_t loc_id, const (char*) dset_name, char *buf ); 133 134 /** 135 136 Query dataset functions 137 138 */ 139 140 herr_t H5LTget_dataset_ndims( hid_t loc_id, const (char*) dset_name, int *rank ); 141 herr_t H5LTget_dataset_info( hid_t loc_id, const (char*) dset_name, hsize_t *dims, H5TClass *type_class, size_t *type_size ); 142 herr_t H5LTfind_dataset( hid_t loc_id, const (char*) name ); 143 144 145 /** 146 147 Set attribute functions 148 149 */ 150 151 herr_t H5LTset_attribute_string( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, const (char*) attr_data ); 152 herr_t H5LTset_attribute_char( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, const (char*) buffer, size_t size ); 153 herr_t H5LTset_attribute_uchar( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, const (ubyte*) buffer, size_t size ); 154 herr_t H5LTset_attribute_short( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, const short *buffer, size_t size ); 155 herr_t H5LTset_attribute_ushort( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, const ushort* buffer, size_t size ); 156 herr_t H5LTset_attribute_int( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, const int *buffer, size_t size ); 157 herr_t H5LTset_attribute_uint( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, const uint *buffer, size_t size ); 158 herr_t H5LTset_attribute_long( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, const long *buffer, size_t size ); 159 herr_t H5LTset_attribute_long_long( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, const long *buffer, size_t size ); 160 herr_t H5LTset_attribute_ulong( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, const ulong *buffer, size_t size ); 161 herr_t H5LTset_attribute_float( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, const float *buffer, size_t size ); 162 herr_t H5LTset_attribute_double( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, const double *buffer, size_t size ); 163 164 /** 165 166 Get attribute functions 167 168 */ 169 170 herr_t H5LTget_attribute( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, hid_t mem_type_id, void *data ); 171 herr_t H5LTget_attribute_string( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, char *data ); 172 herr_t H5LTget_attribute_char( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, char *data ); 173 herr_t H5LTget_attribute_uchar( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, ubyte *data ); 174 herr_t H5LTget_attribute_short( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, short *data ); 175 herr_t H5LTget_attribute_ushort( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, ushort* data ); 176 herr_t H5LTget_attribute_int( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, int *data ); 177 herr_t H5LTget_attribute_uint( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, uint *data ); 178 herr_t H5LTget_attribute_long( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, long *data ); 179 herr_t H5LTget_attribute_long_long( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, long *data ); 180 herr_t H5LTget_attribute_ulong( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, ulong *data ); 181 herr_t H5LTget_attribute_float( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, float *data ); 182 herr_t H5LTget_attribute_double( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, double *data ); 183 184 185 /** 186 187 Query attribute functions 188 189 */ 190 191 192 herr_t H5LTget_attribute_ndims( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, int *rank ); 193 herr_t H5LTget_attribute_info( hid_t loc_id, const (char*) obj_name, const (char*) attr_name, hsize_t *dims, H5TClass *type_class, size_t *type_size ); 194 195 /** 196 197 General functions 198 199 */ 200 201 hid_t H5LTtext_to_dtype(const (char*) text, H5LT_lang_t lang_type); 202 herr_t H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type, size_t *len); 203 204 /** 205 206 Utility functions 207 208 */ 209 210 herr_t H5LTfind_attribute( hid_t loc_id, const (char*) name ); 211 htri_t H5LTpath_valid(hid_t loc_id, const (char*) path, hbool_t check_object_valid); 212 213 /** 214 215 File image operations functions 216 217 */ 218 219 hid_t H5LTopen_file_image(void *buf_ptr, size_t buf_size, uint flags); 220 221 /** 222 H5PTpublic 223 */ 224 225 /** 226 227 Create/Open/Close functions 228 229 */ 230 231 hid_t H5PTcreate_fl ( hid_t loc_id, const (char*) dset_name, hid_t dtype_id, hsize_t chunk_size, int compression ); 232 static if (VLPT_REMOVED) 233 hid_t H5PTcreate_vl ( hid_t loc_id, const (char*) dset_name, hsize_t chunk_size ); 234 235 hid_t H5PTopen( hid_t loc_id, const (char*) dset_name ); 236 herr_t H5PTclose( hid_t table_id ); 237 238 /** 239 240 Write functions 241 242 */ 243 244 herr_t H5PTappend( hid_t table_id, size_t nrecords, const (void*) data ); 245 246 /** 247 248 Read functions 249 250 */ 251 252 herr_t H5PTget_next( hid_t table_id, size_t nrecords, void * data ); 253 herr_t H5PTread_packets( hid_t table_id, hsize_t start, size_t nrecords, void *data ); 254 255 /** 256 257 Inquiry functions 258 259 */ 260 261 262 herr_t H5PTget_num_packets( hid_t table_id, hsize_t *nrecords ); 263 herr_t H5PTis_valid( hid_t table_id ); 264 static if (VLPT_REMOVED) 265 herr_t H5PTis_varlen( hid_t table_id ); 266 267 /** 268 269 Packet Table "current index" functions 270 271 */ 272 273 herr_t H5PTcreate_index( hid_t table_id ); 274 herr_t H5PTset_index( hid_t table_id, hsize_t pt_index ); 275 herr_t H5PTget_index( hid_t table_id, hsize_t *pt_index ); 276 277 /** 278 279 Memory Management functions 280 281 */ 282 283 static if (VLPT_REMOVED) 284 herr_t H5PTfree_vlen_readbuff( hid_t table_id, size_t bufflen, void * buff ); 285 286 /** 287 H5TBpublic 288 */ 289 290 /** 291 292 Crea functions 293 294 */ 295 296 herr_t H5TBmake_table( const (char*) table_title, hid_t loc_id, const (char*) dset_name, hsize_t nfields, hsize_t nrecords, 297 size_t type_size, const (char**) field_names, const size_t *field_offset, const hid_t *field_types, 298 hsize_t chunk_size, void *fill_data, int compress, const (void*) buf ); 299 300 301 /** 302 303 Write functions 304 305 */ 306 307 herr_t H5TBappend_records( hid_t loc_id, const (char*) dset_name, hsize_t nrecords, size_t type_size, const size_t *field_offset, 308 const size_t *dst_sizes, const (void*) buf ); 309 310 herr_t H5TBwrite_records( hid_t loc_id, const (char*) dset_name, hsize_t start, hsize_t nrecords, size_t type_size, const size_t *field_offset, 311 const size_t *dst_sizes, const (void*) buf ); 312 313 herr_t H5TBwrite_fields_name( hid_t loc_id, const (char*) dset_name, const (char*) field_names, hsize_t start, hsize_t nrecords, 314 size_t type_size, const size_t *field_offset, const size_t *dst_sizes, const (void*) buf ); 315 316 herr_t H5TBwrite_fields_index( hid_t loc_id, const (char*) dset_name, hsize_t nfields, const int *field_index, hsize_t start, 317 hsize_t nrecords, size_t type_size, const size_t *field_offset, const size_t *dst_sizes, const (void*) buf ); 318 319 320 /** 321 322 Read functions 323 324 */ 325 326 herr_t H5TBread_table( hid_t loc_id, const (char*) dset_name, size_t dst_size, const size_t *dst_offset, const size_t *dst_sizes, 327 void *dst_buf ); 328 329 herr_t H5TBread_fields_name( hid_t loc_id, const (char*) dset_name, const (char*) field_names, hsize_t start, hsize_t nrecords, 330 size_t type_size, const size_t *field_offset, const size_t *dst_sizes, void *buf ); 331 332 herr_t H5TBread_fields_index( hid_t loc_id, const (char*) dset_name, hsize_t nfields, const int *field_index, hsize_t start, 333 hsize_t nrecords, size_t type_size, const size_t *field_offset, const size_t *dst_sizes, void *buf ); 334 335 336 herr_t H5TBread_records( hid_t loc_id, const (char*) dset_name, hsize_t start, hsize_t nrecords, size_t type_size, 337 const size_t *dst_offset, const size_t *dst_sizes, void *buf ); 338 339 340 /** 341 342 Inquiry functions 343 344 */ 345 346 herr_t H5TBget_table_info ( hid_t loc_id, const (char*) dset_name, hsize_t *nfields, hsize_t *nrecords ); 347 herr_t H5TBget_field_info( hid_t loc_id, const (char*) dset_name, char **field_names, size_t *field_sizes, size_t *field_offsets, 348 size_t *type_size ); 349 350 351 /** 352 353 Manipulation functions 354 355 */ 356 357 herr_t H5TBdelete_record( hid_t loc_id, const (char*) dset_name, hsize_t start, hsize_t nrecords ); 358 herr_t H5TBinsert_record( hid_t loc_id, const (char*) dset_name, hsize_t start, hsize_t nrecords, size_t dst_size, const size_t *dst_offset, 359 const size_t *dst_sizes, void *buf ); 360 herr_t H5TBadd_records_from( hid_t loc_id, const (char*) dset_name1, hsize_t start1, hsize_t nrecords, const (char*) dset_name2, 361 hsize_t start2 ); 362 herr_t H5TBcombine_tables( hid_t loc_id1, const (char*) dset_name1, hid_t loc_id2, const (char*) dset_name2, const (char*) dset_name3 ); 363 herr_t H5TBinsert_field( hid_t loc_id, const (char*) dset_name, const (char*) field_name, hid_t field_type, hsize_t position, 364 const (void*) fill_data, const (void*) buf ); 365 herr_t H5TBdelete_field( hid_t loc_id, const (char*) dset_name, const (char*) field_name ); 366 367 368 /** 369 370 Table attribute functions 371 372 */ 373 374 herr_t H5TBAget_title( hid_t loc_id, char *table_title ); 375 htri_t H5TBAget_fill(hid_t loc_id, const (char*) dset_name, hid_t dset_id, ubyte *dst_buf); 376 377 } // end extern(C)